<?php


  /*******************************
  技术支持： 唤梦科技
  website : http://www.dreammm.net
  QQ 75039960
  Mobile 18665802636
  ********************************/

include_once ("common.php");


define("LN", __LINE__);//行号
define("FL", __FILE__);//当前文件

function TestDb($postObj,$content)
{
     $content = InitDb();
     $responseStr=transmitText($postObj, $content);
      echo $responseStr;
}



function  InitDb()
{
     $db_name = "hmkj.db";
     if (!file_exists($db_name))
     {
          if (!($fp = fopen($db_name, "w+")))
          {
              exit(error_code(-1, LN));
            }
           fclose($fp);
      }


    return "唤梦科技数据库测试" ;

  /*
      //    打开数据库文件
      //sqlite_open  this not suported in server
      //经测试发现服务器 不支持sqlite
     if (!($db = sqlite_open($db_name)))
     {
          exit(error_code(-2, LN));
      }




     //产生数据表结构
       if (!sqlite_query($db, "DROP TABLE hmkj"))
       {
                 exit(error_code(-3, LN));
        }
       if (!sqlite_query($db, "CREATE TABLE hmkj (user_id varchar(30), operation varchar(30) , make_time integer)"))
        {
               exit(error_code(-3, LN));
               //id integer primary key,
         }
      //插入一条数据
       if (!sqlite_query($db, " INSERT INTO uploads (user_id, make_time) VALUES ('lgl', 'query',  '"   .time().   "') "   ) )
       {
              exit(error_code(-4, LN));
        }
      //把数据检索出来
        if (!($result = sqlite_query($db, "SELECT * FROM hmkj")))
        {
            exit(error_code(-5, LN));
         }
          //获取检索数据并显示
         $res = "";
        while ($array = sqlite_fetch_array($result))
        {
            //echo "ID: ". $array[file_name] ."<br>: ". $array[make_time] ;
            $res = $res.  "user_id=".$array[user_id]  .  " ,make_time=".$array[make_time]
         }

         return  $res;

         */

   }


?>